/**  
 * @Title: CustomObjectFactory.java  
 * @Package com.blog4java.mybatis.objectfactory  
 * @Description: TODO(用一句话描述该文件做什么)  
 * @author suyuhao  
 * @date 2025-05-27 09:20:47   
 */
package com.blog4java.mybatis.objectfactory;

import java.util.UUID;

import org.apache.ibatis.reflection.factory.DefaultObjectFactory;

/**  
* @ClassName: CustomObjectFactory  
* @Description: 自定义ObjectFactory的案例  
* @author suyuhao  
* @date 2025-05-27 09:20:47
*/
public class CustomObjectFactory extends DefaultObjectFactory{
	@Override
	public <T> T create(Class<T> type) {
        if(type.equals(User.class)){
            //实例化User类
            User user = (User)super.create(type);
            user.setUuid(UUID.randomUUID().toString());
            return (T) user;
        }
		// TODO Auto-generated method stub
		return super.create(type);
	}
}
